#include <stdio.h>

#include "DList.h"

int main()
{
    Node* head;
    DListInit(&head);
    DListPrint(head);


    DListPushBack(head,1);
    DListPushFront(head,2);
    DListPushFront(head,3);
    printf("%d\n",DListSize(head));
    DListPrint(head);

    DListPopBack(head);
    printf("%d\n",DListSize(head));
    DListPrint(head);

    DListPopFront(head);
    printf("%d\n",DListSize(head));
    DListPrint(head);

    DListPushBack(head,1);
    DListPushBack(head,2);
    DListPushBack(head,3);
    DListPushBack(head,4);
    DListPushBack(head,5);
    DListPushBack(head,6);
    printf("%d\n",DListSize(head));
    DListPrint(head);

    //DListInsert(DListFind(head,3),9);
    //printf("%d\n",DListSize(head));
    //DListPrint(head);
    // 不管是DListInsert还是DListInsert1 , 只需要一个就可以，如果有两个，下一个的pos 会在上一个的pos的位置开始算，而不是从第一个元素
    
    DListInsert1(DListFind(head,5),8);
    printf("%d\n",DListSize(head));
    DListPrint(head);

    DListErase(DListFind(head,4));
    printf("%d\n",DListSize(head));
    DListPrint(head);

    DListErase(DListFind(head,5));
    printf("%d\n",DListSize(head));
    DListPrint(head);

    return 0;
}
